<div class="panel panel-default">

<div class=" panel-heading">Works</div>
<div class="panel-body">
	<?php if(isset($msg)):?>
	<?php if($msg){?>
		<div class="alert alert-success"><?=$msg?>
		</div>
		<?php }?>		
			<?php endif;?>
<a class="btn btn-warning btn-sm pull-right" href="<?=site_url('catalog/works')?>/viewWork/<?=$this->uri->segment(4)?>"><i class="glyphicon glyphicon-arrow-left"></i> <?=nbs(1)?> back to list</a>
</div>
	
</div>
<div class="row">
<form class="form" role="form" method="post" action="">
	<div class="col-md-6">
		<div class="panel panel-default">
		<div class="panel-heading">Work's informations</div>
			<div class="panel-body">
	<div class="form-group">
			<label>Activity <?php if($editWork->active == '1' ){?><span class="label label-success">Active</span><?php }else{?><span class="label label-danger">Blocked</span><?php }?></label>
			<select class="form-control" name="active">
				<option value="1" <?php if($editWork->active == 1 ){?>selected="selected"<?php }?>>active</option>
				<option value="0" <?php if($editWork->active == 0 ){?>selected="selected"<?php }?>>désactivé</option>
			</select>
		</div>
		
		<div class="form-group">
			<label>Customer</label>
			<select class="form-control" name="customer_id">
				<option value="0">Choose a customer...</option>
				<?php foreach ($customers as $c):?>
				<option value="<?=$c->id?>" <?php if($editWork->client_id==$c->id){?>selected="selected"<?php }?>><?=$c->name?></option>
				<?php endforeach;?>
			</select>
		</div>
		
		<div class="form-group">
			<label>Name:</label>
			<input class="form-control" type="text" name="name" value="<?=$editWork->name?>"  autofocus>
		</div>
		
		<div class="form-group">
			<label>Short description:</label>
			<input class="form-control" type="text" name="description" value="<?=$editWork->description?>" >
		</div>
		<button type="submit" class="btn btn-primary pull-right">Update</button>
		<div class="clearfix"></div>
		</div>
		</div>
		</div>
		
		<div class="col-md-6">
			<div class="panel panel-default">
			
				<div class="panel-heading">Tags</div>
				<div class="panel-body">
				
					  <select data-placeholder="Type of this work..." style="width:350px;" multiple class="chosen-select" tabindex="8" name="tag_id[]">
					   
					  <?php foreach ($tags as $tag):?>
					  <option value="<?=$tag->id?>" <?php if($tag->tag !=NULL && isset($tagItems) ){ foreach ($tagItems as $tagItem): if($tagItem==$tag->id){?>selected<?php }  endforeach; }?>><?=$tag->tag?></option>
					  <?php endforeach;?>
          			  </select>
				
				</div>
			
			</div>
		
		</div>
		
		</form>
		</div>

		 <script type="text/javascript">
    var config = {
      '.chosen-select'           : {},
      '.chosen-select-deselect'  : {allow_single_deselect:true},
      '.chosen-select-no-single' : {disable_search_threshold:10},
      '.chosen-select-no-results': {no_results_text:'Oops, nothing found!'},
      '.chosen-select-width'     : {width:"95%"}
    }
    for (var selector in config) {
      $(selector).chosen(config[selector]);
    }
  </script>
